response={ "store": {
    "book": [
      { "category": "reference",
        "author": "Nigel Rees",
        "title": "Sayings of the Century",
        "price": 8.95
      },
      { "category": "fiction",
        "author": "Evelyn Waugh",
        "title": "Sword of Honour",
        "price": 12.99
      },
      { "category": "fiction",
        "author": "Herman Melville",
        "title": "Moby Dick",
        "isbn": "0-553-21311-3",
        "price": 8.99
      },
      { "category": "fiction",
        "author": "J. R. R. Tolkien",
        "title": "The Lord of the Rings",
        "isbn": "0-395-19395-8",
        "price": 22.99
      }
    ],
    "bicycle": {
      "color": "red",
      "price": 19.95
    }
  },
  "expensive": 10
}
import jsonpath
def test_author():
    author_list=jsonpath.jsonpath(response,'$.store.book[*].author')
    assert author_list == ["Nigel Rees","Evelyn Waugh","Herman Melville","J. R. R. Tolkien"]
def test_all_price():
    store_price_list=jsonpath.jsonpath(response,'$.store..price')
    assert store_price_list == [8.95,12.99,8.99,22.99,19.95]
def test_third_title():
    book_3=jsonpath.jsonpath(response,'$.store.book[2]')
    assert book_3[0]['title']=='Moby Dick'
def test_last_book_isbn():
    last_book_isbn=jsonpath.jsonpath(response,f'$.store.book[-1:]')
    assert last_book_isbn[0]['isbn']=='0-395-19395-8'
def test_12_book_price():
    book_12=jsonpath.jsonpath(response,'$..book[0,1].price')
    assert book_12[0]+book_12[1]==8.95+12.99
def test_2books_cheap_than_10():
    book_lg10=jsonpath.jsonpath(response,'$..book[?(@.price<10)]')
    assert len(book_lg10)<=2
def test_has_color():
    colorful_goods=jsonpath.jsonpath(response,'$.store..[?@.color]')
    assert "red" == colorful_goods[0]['color']
